﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            SortedList sortedlist = new SortedList();
            sortedlist.Add(1, "小猪giao奇");
            sortedlist.Add(3, "奥利给");
            sortedlist.Add(7, "里");
            sortedlist.Add(5, "万");
            sortedlist.Add(9,"空");
            sortedlist.Add(8, "晴"); 
            sortedlist.Add(100, "aaa");
            sortedlist.Add(2, "giao");
            Console.WriteLine("请输入编号");
            int id = int.Parse(Console.ReadLine());
            bool flag = sortedlist.Contains(id);
            if(flag)
            {
                string name = sortedlist[id].ToString();
                Console.WriteLine("查询的信息：{0}",name);

            }
            else
            {
                Console.WriteLine("查询无效");
            }
            Console.WriteLine("全部信息如下：");
            foreach(DictionaryEntry v in sortedlist)
            {
                int key = (int)v.Key;
                string value = v.Value.ToString();
                Console.WriteLine("编号：{0}，姓名：{1}",key,value);
            }
        }
    }
}
